//文字滚动
var scrollingText = document.querySelector('.scrolling-text');

scrollingText.addEventListener('mouseenter', function() {
  scrollingText.style.animationPlayState = 'paused';
});

scrollingText.addEventListener('mouseleave', function() {
  scrollingText.style.animationPlayState = 'running';
});


let notice=document.getElementById("notice");
let state=1;
let now0;
let minutes0;
let onesDigit0;

function change(){
	switch(state){
	case 1:notice.innerHTML="请下杆";break;
	case 2:notice.innerHTML="钓鱼中...";break;
	case 3:notice.innerHTML="恭喜啊，运气不错！";break;
	case 4:notice.innerHTML="很抱歉，下次加油";break;
	case 5:notice.innerHTML="没下杆还想钓鱼？";break;
	case 6:notice.innerHTML="不对吧";break;
	default :notice.innerHTML=onesDigit;	
}
}

let fish=document.getElementById("fish1");
下杆
function gofishing() {
  state = 2;
  now0 = new Date();
  minutes0 = now0.getMinutes();
  onesDigit0 = minutes0 % 10; //当前时间的分的个位数
  change();
  fish.style.top="300px";
  fish.style.left="0px";
  fish.style.animation="mymove 15s ease alternate infinite";
  
  
}

//收杆
function backfishing() {
	if(state==1)
	{
		state=5;
		change();
		state=1;
	}
	else {
		let now1 = new Date();
  let minutes1 = now1.getMinutes();
  let onesDigit1 = minutes1 % 10; //当前时间的分的个位数
  let radoum = Math.random();                                        //随机数
  let r = 0;
  if (radoum >= 0.5) r = 1;
  else r = 0;
  if ((onesDigit0 + onesDigit1) % 2&&r==1) {
    state = 3;
    fish.style.animation="none";
    fish.style.transition = "top 3s ease"; // 设置过渡效果
    fish.style.top = "0"; // 将fish1元素的top属性设置为0，使其慢慢移动到窗口顶部
    
    
  } else {
    state = 4;
  }
  change();
	}
  
}

let fishtalk=document.getElementById("fishtalk");
function clickfish(){
	fishtalk.style.background="red";
}
